package com.shadow.baiqun.delegate.receive.adapter;

import android.content.Context;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.shadow.baiqun.R;
import com.shadow.baiqun.delegate.send.SendGoodsEntity;

import java.util.List;

/**
 * @author zhangyu
 * @date 2018/7/25
 */

public class SendGoodsAdapter extends BaseQuickAdapter<SendGoodsEntity, BaseViewHolder> {
    private int mColorDone;
    private int mColorUnDeal;

    public SendGoodsAdapter(Context context, int layoutResId, @Nullable List<SendGoodsEntity> data) {
        super(layoutResId, data);
        mColorDone = context.getResources().getColor(R.color.app_background_light);
        mColorUnDeal = context.getResources().getColor(R.color.white);

    }

    @Override
    protected void convert(BaseViewHolder helper, SendGoodsEntity item) {
        helper.setText(R.id.tv_car_number, item.getCarNum());
        helper.setText(R.id.tv_car_order, item.getTodayOrder());
        helper.setText(R.id.tv_add_person, item.getAddUserName());
        helper.setText(R.id.tv_add_time, item.getAddTime());
        if (item.getDoneUserid() != null && !item.getDoneUserid().isEmpty()) {
            helper.setBackgroundColor(R.id.layout_item, mColorDone);
        } else {
            helper.setBackgroundColor(R.id.layout_item, mColorUnDeal);
        }
    }
}
